import React, { useState } from 'react';
import { DownOutlined } from '@ant-design/icons';
import { Dropdown, Space } from 'antd';
import { useNavigate, Link } from 'react-router-dom';
// import '../../static/css/NavBar.css'

function Admin_integralNavBar({ address }) {
    const [open3, setOpen3] = useState(false);
    const navigate = useNavigate();
    const handleMenuClick3 = (e) => {
        // if (e.key === '6') {
        //     navigate(`/admin/${address}/Admin_credits/Admin_AddExchangeRule`);
        //     setOpen3(false);
        // }
        if (e.key === '7') {
            navigate(`/admin/${address}/Admin_credits/Admin_RuleList`);
            setOpen3(false);
        }
        if (e.key === '8') {
            navigate(`/admin/${address}/Admin_credits/Admin_ExchangeRecordList`);
            setOpen3(false);
        }
    };
    const handleOpenChange3 = (nextOpen, info) => {
        if (info.source === 'trigger' || nextOpen) {
            setOpen3(nextOpen);
        }
    };
    const items3 = [
        // {
        //     label: ' 添加积分兑换规则',
        //     key: '6',
        // },
        {
            label: '积分列表',
            key: '7',
        },
        {
            label: '用户兑换记录',
            key: '8',
        },
    ];

    return (
        <nav className="navbar navbar-expand-lg fixed-top portfolio-navbar navbar-dark">
            <div className="container">
                <a className="navbar-brand logo" href="#">先锋积分</a>
                <button className="navbar-toggler" data-bs-target="#navbarNav" data-bs-toggle="collapse">
                    <span className="visually-hidden">Toggle navigation</span>
                    <span className="navbar-toggler-icon" />
                </button>
                <div className="collapse navbar-collapse" id="navbarNav">
                    <ul className="navbar-nav ms-auto">
                        <li className="nav-item">
                            <Link className="nav-link" to={`/admin/${address}`}>管理员端首页</Link>
                        </li>
                        <li className="nav-item">
                            {/* <Link className="nav-link" to={`/admin/${address}`}>学生信息管理</Link> */}
                            <Dropdown
                                style={{
                                    width: '200px !important',
                                    maxHeight: '300px !important',
                                }}
                                menu={{
                                    items: items3,
                                    onClick: handleMenuClick3,
                                }}
                                onOpenChange={handleOpenChange3}
                                open={open3}
                            >
                                <Link to="#" className="nav-link">
                                    <Space>
                                        积分兑换管理
                                        <DownOutlined />
                                    </Space>
                                </Link>
                            </Dropdown>
                        </li>
                        {/* <li className="nav-item">
                            <Link className="nav-link" to={`/admin/${address}/Admin_integral/Admin_publishActivity`}>活动发布</Link>
                        </li> */}
                        <li className="nav-item">
                            <Link className="nav-link" to={`/admin/${address}/Admin_integral/Admin_ActivityList`}>活动管理</Link>
                        </li>
                        {/* <li className="nav-item">
                            <Link className="nav-link" to={`/admin/${address}/Admin_integral/Admin_ResearchPoint`}>积分查询</Link>
                        </li> */}
                        {/* <li className="nav-item">
                            <Link className="nav-link" to={`/admin/${address}/Admin_integral/Admin_UserInfoList`}>用户管理</Link>
                        </li> */}
                        <li className="nav-item">
                            <Link className="nav-link" to={`/`}>退出登录</Link>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    );
}

export default Admin_integralNavBar;